<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    点击次数：{{counter}}
    <button @click="counter++">+1</button>
    <button @click="handleAdd(10)">+10</button>
    <br>
    <a href="http://www.baidu.com" @click="handleClick('禁止打开',$event)">打开链接</a><br>
    <a href="http://www.baidu.com" @click.prevent="handle('不再重载页面')">打开链接</a><br>
    <a @click.stop="handle('Stop')">阻止单击事件冒泡</a><br>
    <a href="http://www.baidu.com" @click.prevent.stop="handle('修饰符串联')">打开链接</a><br>

    <input type="text" @keyup.enter="submit" v-model="text">
</div>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            message: '这是一段文本',
            counter: 0,
            text:''
        },
        methods: {
            handleAdd: function (count) {
                count = count || 1;
                this.counter += count;
            },
            handleClick: function (message, event) {
                event.preventDefault();
                window.alert(message);
            },
            handle: function (message) {
                window.alert(message);
            },
            submit:function (){
                window.alert(this.text)
            }
        }
    })
</script>
</body>
</html>
